<script>
export default {
	onLaunch: function() {
		console.log('App Launch');
		// #ifdef APP-PLUS
		// 锁定屏幕方向
		plus.screen.lockOrientation('portrait-primary'); //锁定
		// 检测升级: 当前版本与远端最新版本号不同提醒更新

		uni.request({
			url: this.$store.state.baseUrl + '/lwj/get_app_version_info',
			method: 'POST',
			data: {},
			success: res => {
				if (res.data.code == 1) {
					plus.runtime.getProperty(plus.runtime.appid, wgtinfo => {
						/* const obj = plus.os.name === 'iOS' ? res.data.data.iOS : res.data.data.Android; */
						let obj = {};
						if (plus.os.name == 'iOS') {
							obj.version = res.data.data.info.ios_version;
							obj.url = res.data.data.info.ios_downloadurl;
						}
						if (plus.os.name == 'Android') {
							obj.version = res.data.data.info.android_version;
							obj.url = res.data.data.info.android_downloadurl;
						}

						if (wgtinfo.version == obj.version) return;
						// 提醒用户更新
						uni.showModal({
							title: '更新提示',
							content: `有新版本,是否选择更新`,
							success: showResult => {
								if (showResult.confirm) {
									plus.runtime.openURL(obj.url);
								}
							}
						});
					});
				}
			},
			fail: () => {},
			complete: () => {}
		});
		// #endif
	},
	onShow: function() {
		console.log('App Show');
	},
	onHide: function() {
		console.log('App Hide');
	}
};
</script>

<style>
/* uni.css - 通用组件、模板样式库，可以当作一套ui库应用 */
@import './common/uni.css';
@import './common/custom.css';
/*每个页面公共css */
/* uni-app默认全局使用flex布局。因为flex布局有利于跨更多平台，尤其是采用原生渲染的平台。如不了解flex布局，请参考http://www.w3.org/TR/css3-flexbox/。如不使用flex布局，请删除或注释掉本行。*/

page {
	height: 100%;
	display: flex;
	background-color: #efeff4;
}

.content {
	display: flex;
	flex: 1;
	flex-direction: column;
	background-color: #efeff4;
	padding: 15upx;
}

.input-group {
	background-color: #ffffff;
	margin-top: 40px;
	position: relative;
}

.input-group::before {
	position: absolute;
	right: 0;
	top: 0;
	left: 0;
	height: 1px;
	content: '';
	-webkit-transform: scaleY(0.5);
	transform: scaleY(0.5);
	background-color: #c8c7cc;
}

.input-group::after {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 1px;
	content: '';
	-webkit-transform: scaleY(0.5);
	transform: scaleY(0.5);
	background-color: #c8c7cc;
}

.input-row {
	display: flex;
	flex-direction: row;
	position: relative;
}

.input-row .title {
	width: 20%;
	height: 50px;
	min-height: 50px;
	padding: 15px 0;
	padding-left: 30px;
	line-height: 50px;
}

.input-row input {
	width: 80%;
	height: 50px;
	min-height: 50px;
	padding: 15px 0;
	padding-right: 30px;
	line-height: 50px;
}

.input-row.border::after {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 15px;
	height: 1px;
	content: '';
	-webkit-transform: scaleY(0.5);
	transform: scaleY(0.5);
	background-color: #c8c7cc;
}

.btn-row {
	margin-top: 50px;
	padding: 20px;
}

button.primary {
	background-color: #0faeff;
}
</style>
